﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;

namespace ProjTemp.Desktop.Common.ResourceManagement
{
    /// <summary>
    /// Resource manage interface
    /// </summary>
    public interface IResourceManage
    {
        /// <summary>
        /// Register a resource dictionary to resource manager.
        /// </summary>
        /// <param name="resourceDictionary">Resource dictionary to be registered.</param>
        /// <param name="subject">The subject of the resource dictionary. Will be added to the global resource if not provided.</param>
        /// <param name="aspect">The aspect of the resource dictionary. Will be treated as the only aspect resource in the subject, if the subject is provided.</param>
        void AddResourceDictionary(ResourceDictionary resourceDictionary,  string subject = null, string aspect = null);

        /// <summary>
        /// Register a resource dictionary entry to resource manager.
        /// </summary>
        /// <param name="key">Key of the resource dictionary entry to be registered.</param>
        /// <param name="value">Value of the resource dictionary entry to be registered.</param>
        /// <param name="subject">The subject of the resource dictionary entry. Will be added to the global resource if not provided.</param>
        /// <param name="aspect">The aspect of the resource dictionary entry. Will be added to the only aspect resource in the subject, if the subject is provided.</param>
        void AddResourceEntry(object key, object value, string subject = null, string aspect = null);

        /// <summary>
        /// Set default aspect of subject
        /// </summary>
        /// <param name="subject">Subject</param>
        /// <param name="aspect">Aspect</param>
        void SetDefaultAspect(string subject, string aspect);

        /// <summary>
        /// Get default aspect of subject
        /// </summary>
        /// <param name="subject">Subject</param>
        /// <returns>Default aspect of subject. Return null if not existed.</returns>
        string GetDefaultAspect(string subject);

        /// <summary>
        /// Get the value of the resource dictionary entry with the key provided.
        /// </summary>
        /// <param name="key">Key of the resource dictionary entry</param>
        /// <param name="subject">The subject of the resource dictionary entry. Will be added to the global resource if not provided.</param>
        /// <param name="aspect">The aspect of the resource dictionary entry. Will be added to the only aspect resource in the subject, if the subject is provided.</param>
        /// <returns>Value of the resource dictionary entry. Return null if nothing found.</returns>
        object GetResourceEntryValue(object key, string subject = null, string aspect = null);

        /// <summary>
        /// Apply the aspect resource dictionary in the subject to the provided resource dictionary.
        /// </summary>
        /// <param name="resourceDictionary">The resource dictionary to be applied to.</param>
        /// <param name="subject">The subject of the resource dictionary. Will apply the global resource dictionary if not provided.</param>
        /// <param name="aspect">The aspect of the resource dictionary. Will apply the only aspect resource dictionary if not provided.</param>
        void ApplyToResourceDictionary(ResourceDictionary resourceDictionary, string subject = null, string aspect = null);
    }
}
